package com.example.sherlockzhong.plush_v2.Utils;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * Created by SherlockZhong on 9/20/14.
 */
public class HashmapJsonUtil {

    public static String hashmapToJson(HashMap map) {
        String result = "{";
        for (Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry e = (Map.Entry) it.next();
            result += "'" + e.getKey() + "':";
            result += "'" + e.getValue() + "',";
        }
        result = result.substring(0, result.lastIndexOf(","));
        result += "}";
        return result;
    }

}
